package com.sservice.commonBusiness.controller.admin;

import com.sservice.base.entity.dto.ListResult;
import com.sservice.commonBusiness.e.DataR;
import com.sservice.commonBusiness.service.DataRService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by byte_su@163.com on 2018/01/12.
 */
@Controller
@RequestMapping("/admin/dataR/")
public class DataRController {

    @Autowired
    DataRService dataRService;


    @RequestMapping(value = "add",method = RequestMethod.POST)
    @ResponseBody
    public ListResult add(DataR dataR) {
        List<DataR> list = new ArrayList();
        list.add(dataR);
        return new ListResult(true, dataRService.addBatch(list));
    }

    /**
     * 条件查询
     *
     * @param dataR
     * @return
     */
    @RequestMapping("selectBy")
    @ResponseBody
    public ListResult list(DataR dataR) {
        List<DataR> list = dataRService.selectBy(dataR);
        return new ListResult(true, list);
    }
}
